//game start
onGameLoaded =
[
	function(){
		cc.LoaderScene.preload(sysMenuScene.resource, function () {
    	cc.loader.load([
				resource.Layout_plist,
				resource.Layout_png,
				resource.ctrlbtnNormalZ_png,
				resource.ctrlbtnDownZ_png,
				resource.ctrlbtnDisableZ_png,
				resource.white1010_png,
				resource.flags_png,
				resource.flags_plist,
				resource.vs_png,
				resource.unlock_png,
				resource.lock_png,
				resource.purchase_png,
				resource.rank_png[0],
				resource.rank_png[1],
				resource.rank_png[2],
				resource.rank_png[3],
				resource.rank_png[4],
				resource.rank_png[5],
				resource.rank_png[6],
				resource.rank_png[7],
				resource.rank_png[8],
				resource.units_aura_png,
				resource.units_tank_png,
				resource.units_footman_png,
				resource.units_cannon_png,
				resource.units_motor_png,
				resource.units_flak_png,
				resource.units_cavalry_png,
			], function () {
				cc.spriteFrameCache.addSpriteFrames(resource.Layout_plist);
				cc.spriteFrameCache.addSpriteFrames(resource.flags_plist);
				cc.director.runScene(sysMenuScene.Create());
			});
		}, this);
	}
];

onSysMenuSceneLoaded =
[
    function(){
    	menuPanel.Initialize();
    	menuPanel.ShowMenu( (userSet.gameUser==null ? 1 : 2), sysMenuScene.layer.fadeinDelay);
    }
];

onCampaignSceneCreate =
[
    function(){ CampaignSceneInitialize(); }
];

onCampaignSceneLoaded =
[
	function(){
		courtPanel.Initialize();
		tipPanel.Initialize();
		directionInfo.Initialize();
		directionMenu.Initialize();
		courtDirectionMenu.Initialize();
		warForceCapture.Initialize();
		troopInfo.Initialize();
		warMist.Initialize();
		warInfo.Initialize();
		ProcessInitialize();
		battleSum.Initialize();
		battleMenu.Initialize();
		reviewLoop.Initialize();
		reviewMenu.Initialize();
	},
	function(){
		gameLoop.StartStep();
	}
];

onNewStepStart =
[
	function(){
	 	TurnShowingForce();
 		var forceCapture = new ForceCapture(campaign, tileEngine);
 		RefreshForceInfo(campaign, tileEngine, forceCapture);
 	},
 	function(){
 		warForceCapture.CreateForceCapture();
 		warMist.RefreshUI();
 		courtTroop.CreateTroop();
 		warTroop.CreateTroop();
 		troopInfo.CreateAllTroopInfo();
 		warInfo.ShowUI();
 	},
 	function(){
 		subtitles.ShowOnce(subtitles.GetNewStepText());
 		campaignScene.canvaslayer.hide(false);
 	}
];

onOldStepEnd =
[
 	function(){
 		campaignScene.canvaslayer.show(true);
 	},
 	function(){
 		warInfo.HideUI();
    	troopInfo.ClearAllTroopInfo();
    	warTroop.ClearTroop();
    	courtTroop.ClearTroop();
    	warForceCapture.ClearForceCapture();
    }
];

onCampaignSceneDestroyed =
[
 	function(){
 		processAnimation.Stop();
 		reviewLoop.StopReviewLoop();
 		gameNetService.StopGetGameData();
 		gameLoop.StopGameLoop();
 		
 		gameRoom = null;
 		campaignRoom = null;
 		
 	}
];